package com.device.repository;

import com.device.entity.DeviceKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.UUID;

@Repository
public interface DeviceKeyRepository extends JpaRepository<DeviceKey, UUID> {
    
    List<DeviceKey> findBySubDeviceIdOrderByKeyNumberAsc(UUID subDeviceId);
    
    long countBySubDeviceIdAndKeyNumber(UUID subDeviceId, Integer keyNumber);
    
    long countBySubDeviceIdAndKeyNumberAndIdNot(UUID subDeviceId, Integer keyNumber, UUID id);
    
    void deleteBySubDeviceId(UUID subDeviceId);
    
    long countBySubDeviceId(UUID subDeviceId);
}